<%-- 
    Document   : upload
    Created on : 1 avr. 2014, 16:03:20
    Author     : phinguyen
--%>

<%@page import="model.Decision"%>
<%@page import="model.Employee"%>
<%@page import="core.StepOwnerCore"%>
<%@page import="model.Document"%>
<%@page import="java.util.ArrayList"%>
<%@page import="model.Docversion"%>
<%@page import="java.util.List"%>
<%@page import="core.telechargertest"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>


<% String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <base href="<%=basePath%>">
    </head>
    <body>
        <h1>Hello World!</h1>

        <form action="Servletupload" method="post" enctype="multipart/form-data" >
            <table>
                <tr>
                    <td>
                        choose a document
                    </td>
                    <td>
                        <select name="doctypeselectd">
                            <%
                                telechargertest tcore = new telechargertest();
                                List<Document> lstdoc = new ArrayList<Document>();
                                lstdoc = tcore.getAllDocument();
                                for (int i = 0; i < lstdoc.size(); i++) {
                                    out.println("<option value=" + lstdoc.get(i).getDocid() + ">");
                                    out.println(lstdoc.get(i).getDocid());
                                    out.println(lstdoc.get(i).getDoctitle());
                                    out.println("</option>");
                                }
                            %>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>
                        choose a employee!!!!!!!!!!!!!!!
                    </td>
                    <td>
                        <select name="empselectd">
                            <%

                                List<Employee> lstemp = new ArrayList<Employee>();
                                lstemp = tcore.getAllEmployees();
                                for (int i = 0; i < lstemp.size(); i++) {
                                    out.println("<option value=\"" + lstemp.get(i).getEid() + "\">");
                                    out.println(lstemp.get(i).getEid());
                                    out.println(lstemp.get(i).getEfirstname() + " " + lstemp.get(i).getEname());
                                    out.println("</option>");
                                }
                            %>
                        </select>
                    </td>
                </tr>
               <tr>
                    <td>title</td>
                    <td> 
                        <input type="text" name="title">
                    </td>
                </tr>
                <tr><td> <select name="decision">
                            <%
                                List<Decision> lstdecision=tcore.getAllDecision();
                                for(int i=0;i<lstdecision.size();i++){
                                    out.println("<option value=\"" + lstdecision.get(i).getDid()+ "\">");
                                    out.println(lstdecision.get(i).getDid());
                                    out.println(lstdecision.get(i).getDstate());
                                    out.println("</option>");
                                }
                            %>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>upload your file</td>
                    <td>
                        <input type="file" name="filename">
                    </td>
                </tr>
            </table>
            <input type="submit" value="ok">
            <input type="reset" value="ko">
        </form>
    </body>
</html>







